package com.phei.netty.protocol.http.xml.codec;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpResponse;

import java.util.List;

public class HttpXmlResponseDecoder extends AbstractHttpXmlDecoder<DefaultFullHttpResponse> {

    public HttpXmlResponseDecoder(Class<?> clazz) {
        this(clazz, false);
    }

    public HttpXmlResponseDecoder(Class<?> clazz, boolean isPrintLog) {
        super(clazz, isPrintLog);
    }

    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, DefaultFullHttpResponse httpXmlResponse, List<Object> list) throws Exception {
        HttpXmlResponse xmlResponse = new HttpXmlResponse(httpXmlResponse, decode0(channelHandlerContext, httpXmlResponse.content()));
        list.add(xmlResponse);
    }
}
